package com.zhima.feignclient;

import com.zhima.dto.FeignQuestionBasicInfoDTO;
import com.zhima.dto.FeignQuestionJudgeInfoDTO;
import com.zhima.dto.FeignQuestionJudgeScoreInfoDTO;
import com.zhima.vo.QuestionBankContestEditQuestionVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("oj-question-service")
@RequestMapping("/oj-question/question/feign")
public interface QuestionFeignClient {
    /**
     * 根据{questionId}获取题目的版本号
     *
     * @param questionId
     * @return
     */
    @GetMapping("/version/{questionId}")
    Long queryQuestionVersion(@PathVariable("questionId") Long questionId);

    /**
     * 根据{questionId}获得题目的基本信息
     *
     * @param questionId
     * @return
     */
    @GetMapping("/q/{questionId}")
    FeignQuestionBasicInfoDTO queryQuestionBasicInfo(@PathVariable("questionId") Long questionId);

    /**
     * 得到题目的用于评测的基本信息
     *
     * @param questionId
     * @return
     */
    @GetMapping("/t/{questionId}")
    FeignQuestionJudgeInfoDTO queryQuestionJudgeInfo(@PathVariable("questionId") Long questionId);

    /**
     * 得到题目的用于评测分数的基本信息
     *
     * @param questionId
     * @return
     */
    @GetMapping("/s/{questionId}")
    FeignQuestionJudgeScoreInfoDTO queryQuestionJudgeScoreInfo(@PathVariable("questionId") Long questionId);

    /**
     * 增加{questionId}的总提交量
     *
     * @param questionId
     * @return
     */
    @PostMapping("/submit/{questionId}")
    boolean increaseSubmitNum(@PathVariable("questionId") Long questionId);

    /**
     * 增加{questionId}的总AC次
     *
     * @param questionId
     * @return
     */
    @PostMapping("/ac/{questionId}")
    boolean increaseAcNum(@PathVariable("questionId") Long questionId);

    /**
     * 按照questionId顺序返回拼装后的QuestionBankContestEditQuestionDTO
     *
     * @param questionId
     * @return
     */
    @PutMapping("/assemble")
    List<QuestionBankContestEditQuestionVO> assembleQuestion(@RequestBody List<Long> questionId);

    /**
     * @param questionNumber
     * @return
     */
    @GetMapping("/id-to-number/{questionNumber}")
    Long getQuestionIdByQuestionNumber(@PathVariable("questionNumber") String questionNumber);

    @PostMapping("/fullMarks")
    List<Integer> listFullMarks(@RequestBody List<Long> questionIds);
}
